package com.atguigu.rabbit.listener;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;

import java.io.UnsupportedEncodingException;

/**
 * @author 杨林
 * @create 2022-10-06 19:08 星期四
 * description:
 */
public class SimpleListener implements MessageListener {
    @Override
    public void onMessage(Message message) {
        try {
            String msg = new String(message.getBody(), "utf-8");
            String consumerTag = message.getMessageProperties().getConsumerTag();
            System.out.println(msg);
            System.out.println(consumerTag);
            System.out.println("-----------------------");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }
}
